#!/usr/bin/perl
# addtrap.cgi



require 'snmp-lib.pl';

#&header($text{'index_title'}, "", undef, undef, 1);
&ReadParse();
&error_setup("Add Trap Receiver");

my $hostName = $in{hostName};
my $commName = $in{commName};
my $lineEntry = "trapsink ".$hostName." ".$commName;

#print $lineEntry;
my $code = &WriteConfFile($hostName, $lineEntry);
if($code)
{
	&error("Failed!");
	&nas_syslog("snmp","naslog_warning",13005,"SNMP module, add trap receiver failed!");
}
else
{
	
	&nas_syslog("snmp","naslog_info",13006,"SNMP module, add trap receiver successful!");
	&redirect("index.cgi");
}


#&footer("/ucd-snmp/trapadd.cgi",$text{'trapadd_title'});
